//
//  ViewController.m
//  GoodsManagement
//
//  Created by 车浩 on 2017/3/7.
//  Copyright © 2017年 CheHao. All rights reserved.
//

#import "ViewController.h"
#import "GMHTTPManage.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *machinesTbaleView;

@property (weak, nonatomic) IBOutlet UITableView *aisleTableView;



@end

@implementation ViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self initTableView];

    // Do any additional setup after loading the view, typically from a nib.
}


- (void)initTableView{ 
    
    //非0即真
    self.machinesTbaleView.delegate = self;
    self.machinesTbaleView.dataSource = self;
    self.machinesTbaleView.tag = 1;
    self.machinesTbaleView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    
    
    self.aisleTableView.dataSource = self;
    self.aisleTableView.delegate = self;
    self.aisleTableView.tag = 0;
    self.aisleTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}

#pragma mark -- tbaleView delefate & dataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return tableView.tag ? 10 : 31;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return tableView.tag ? 45 : 65;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (tableView.tag) {
        
        NSString *cellId = @"machinesTableViewCellId";
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
        
        if (cell == nil) {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        }
        cell.textLabel.text = @"理货机";
        cell.textLabel.textAlignment = NSTextAlignmentCenter;
        
        return cell;
    }
    
    
    NSString *cellId = @"aisleTVCId";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId];
    }
    cell.imageView.image = [UIImage imageNamed:@"头像"];
    cell.textLabel.text = @"3M防霾口罩";
    cell.detailTextLabel.text = @"剩余：3";
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}
    
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{


}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
